package com.ocm.tourism.core.model;

public class FieldCriteria {

   private String name;
   
   private Object value;

   private ComparisonType comparisonType;

   private ConditonalType conditonalType;

   public String getName() {
      return name;
   }

   public void setName(String name) {
      this.name = name;
   }

   public Object getValue() {
      return value;
   }

   public void setValue(Object value) {
      this.value = value;
   }

   public ComparisonType getComparisonType() {
      return comparisonType;
   }

   public void setComparisonType(ComparisonType comparisonType) {
      this.comparisonType = comparisonType;
   }

   public ConditonalType getConditonalType() {
      return conditonalType;
   }

   public void setConditonalType(ConditonalType conditonalType) {
      this.conditonalType = conditonalType;
   }

   public String appendCritera(String sql){
      StringBuffer stringBuffer = new StringBuffer(sql);
      stringBuffer.append(conditonalType == null ? ConditonalType.AND.name() : conditonalType.name()).append(name).append(" " + comparisonType.getValue()).append(" :").append(name);
      return stringBuffer.toString();
   }
}
